<template>
    <div class="chooseArea">
        <div class="title">
            <div class="back" @click="router.go(-1)"></div>
            <p>选择城市</p>
            <div></div>
        </div>
        <div class="chooseArea-text">网鱼电竞酒店已入住以下城市</div>
        <ul>
            <li>全国</li>
            <li v-for="(item, index) in AreaList.List" :key="index" @click="goHome(item)">{{ item }}</li>
        </ul>
    </div>
</template>
  
<script setup lang="ts">
import { reactive, onMounted, ref } from 'vue'
import { getAreaSupport } from '@/api/api'

//路由
import { useRouter } from 'vue-router'

let router = useRouter();
const AreaList = reactive<{ List: any }>({
    List: []
})

function goHome(selectArea: string) {
    router.push({
        path: '/',
        query: {
            area: selectArea,
        }
    })
}

onMounted(() => {
    getAreaSupport().then((res) => {
        // let kk = JSON.parse(JSON.stringify(res.data))
        AreaList.List = res.data
    })

})
</script>
  
<style lang="less" scoped>
.auto-img {
    width: 100%;
    height: 100%;
    display: block;
}

.chooseArea {
    min-height: 100vh;
    color: #f8f8fa;

    .title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 10px;

        .back {
            width: 20px;
            height: 20px;
            background-size: cover;
            background-image: url('@/assets/icon/ZR.png');
        }

        p {
            font-size: 16px;
            font-weight: 800;
            color: black;
        }
    }

    .chooseArea-text {
        color: black;
        padding: 0 10px;
        font-size: 12px;
        text-align: center;
        padding: 0 0 10px;
    }

    ul {
        background-color: white;

        li {
            height: 40px;
            font-size: 13px;
            padding: 0 10px;
            color: black;
            display: flex;
            align-items: center;
            border-bottom: 1px solid #f0f0f0;
        }
    }
}
</style>
  